package com.atguigu.srb.sms.utils;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Data
@Component
//注意prefix要写到最后一个 "." 符号之前
//调用setter为成员赋值
@ConfigurationProperties(prefix = "yuntongxun.sms")
public class SmsProperties implements InitializingBean {
    private String accountSId;
    private String accountToken;
    private String appId;
    private String templateId;

    public static String ACCOUNT_SID;
    public static String ACCOUNT_TOKEN;
    public static String APP_ID;
    public static String TEMPLATE_ID;

    @Override
    public void afterPropertiesSet() throws Exception {
        ACCOUNT_SID=accountSId;
        ACCOUNT_TOKEN=accountToken;
        APP_ID=appId;
        TEMPLATE_ID=templateId;
    }
}
